∂{extend name="public:body" /}

{block name="header"}
  <div class="layui-tab layui-tab-brief">
    <ul class="layui-tab-title" style="padding:10px 0;height:30px;">
      <li>用户战绩</li>
    </ul>
  </div>
{/block}
{block name="body"}
  <style>
    .fright {
      float: right;
    }
    .btn {
      border: 0;
      background: transparent;
    }
    .a-btn {
      color: #008800;
    }
    .a-btn:hover {
      color: #008800;
    }
    .layui-form-item {
      position: relative;
    }
    .down-menu {
      position: absolute;
      top: 40px;
      text-align: center;
      right: 0;
      background: #009688;
      color: white;
      z-index: 999;
      border-radius: 3px;
      padding: 5px 0;
      display: none;
    }
    .down-menu li {
      padding: 5px 30px;
      cursor: pointer;
    }
    .down-menu li:hover {
      background: #3EABA0;
    }
  </style>

  <div class="layui-card-body">
    <div class="layui-form">
      <div class="layui-form-item">
        <div class="layui-input-inline">
          <input value="{php}echo isset($param['tid']) ? $param['tid'] : ''; {/php}" type="text" name="tid" placeholder="请输入桌子ID" class="layui-input">
        </div>
        <button type="button" class="layui-btn" onclick="search()">搜索</button>
      </div>
    </div>

    <table class="layui-table table table-hover table-bordered table-list" id="menus-table" lay-size="sm">
      <thead>
        <tr>
          <th class="tc">桌子ID</th>
          <th class="tc">用户ID</th>
          <th class="tc">用户电话号码</th>
          <th class="tc">用户昵称</th>
          <th class="tc">游戏局数</th>
          <th class="tc">盈亏</th>
          <th class="tc" width="120">创建时间</th>
        </tr>
      </thead>
      <tbody>
        <?php foreach($list as $v){?>
          <tr>
            <td class="tc">
              <a href="#" type="button" class="a-btn">
                {$v.tid}
              </a>
            </td>
            <td class="tc">{$v.uid}</td>
            <td class="tc">{$v.phone}</td>
            <td class="tc">{$v.username}</td>
            <td class="tc">{$v.innings}</td>
            <td class="tc">
              {if $v['win'] > 0}
              <font color="red">+{$v.win}</font>
              {else /}
              <font color="#008800">{$v.win}</font>
              {/if}
            </td>
            <td class="tc">{$v.create_time|date='Y-m-d H:i:s'}</td>
            
          </tr>
        <?php } ?>
      </tbody>
      <tfoot>
        <tr>
          <td colspan="9" class="tc">
            {$page|raw}
            <span>共{$count}条</span>
            <span>
              {$limit|raw}
            </span>
          </td>
        </tr>
      </tfoot>
    </table>
  </div>

  <script>
    var url   = "/publics/user/record",
        limit = 10

    // 页面选择
    var selectlimit = function() {
      limit = $('[name=limit]').val()
      window.location.href = url + "&limit="+limit
    }

    // 搜索会员
    var search = function() {
      var val = $('[name=tid]').val()
      window.location.href = url + "&limit="+limit+"&tid="+val
    }
  </script>
{/block}
